package online.longzipeng.cinemasys.config;

import online.longzipeng.cinemasys.common.interceptor.IpInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;
import java.util.List;

/**
 * @author lzp
 * @date 2021/4/25 13:39
 * 拦截器配置
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        List<String> excludePathPatterns = Arrays.asList("/*.css","/*.js","/*.css","/*.jpeg","/*.html");
        registry.addInterceptor(new IpInterceptor()).addPathPatterns("/**")
        .excludePathPatterns(excludePathPatterns);
    }
}
